package util.apps.gump;

import java.awt.*;

import javax.swing.*;

import util.gen.*;
import java.io.*;


public class GumpDrawFrame extends JFrame{
	private GumpApplicationPanel applicationPanel;
	private JScrollPane applicationScrollPane;
	private Container contentPane;
	private int width = 700;
	private int height = 1000;
	
	public GumpDrawFrame(Gump gump){
		
		//instantiate panels
		applicationPanel = new GumpApplicationPanel(gump, this);
		applicationScrollPane = new JScrollPane(applicationPanel);
		this.addComponentListener(applicationPanel);
		
		//set frame params
		setSize(width,height);
		setTitle("Command Line Application Wrapper");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLayout(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		contentPane = getContentPane();
		
		//add scroll pane to frame
		c.weighty = 1;
		c.weightx = 0.5;
		c.fill = GridBagConstraints.BOTH;
		c.anchor = GridBagConstraints.LINE_START;
		c.gridx = 0;
		c.gridy = 0;
		contentPane.add(applicationScrollPane,c);
		
		//make button panel
		GumpToolPanel toolPanel = new GumpToolPanel();
		c.weighty = 0;
		c.gridy = 1;
		contentPane.add(toolPanel,c);
		
		pack();
		
		//make visible
		setVisible(true);
	}
	


	public GumpApplicationPanel getApplicationPanel() {
		return applicationPanel;
	}

	public void setApplicationPanel(GumpApplicationPanel applicationPanel) {
		this.applicationPanel = applicationPanel;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}
	
}